package com.mszlu.news.admin.controller;

import com.mszlu.news.admin.model.params.CommentParam;
import com.mszlu.news.admin.service.CommentService;
import com.mszlu.news.admin.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "文章评论")
@RestController
@RequestMapping("comment")
public class CommentController {
    @Autowired
    private CommentService commentService;

    @ApiOperation(value = "查询评论")
    @PostMapping("select")
    public Result selectComment(@RequestBody CommentParam commentParam){
        return commentService.selectComment(commentParam);
    }

    @ApiOperation(value = "新增评论")
    @PostMapping("insert")
    public Result insertComment(@RequestBody CommentParam commentParam){
        return commentService.insertUser(commentParam);
    }

    @ApiOperation(value = "更新评论")
    @PostMapping("update")
    public Result updateComment(@RequestBody CommentParam commentParam){
        return commentService.updateUser(commentParam);
    }

    @ApiOperation(value = "通过id删除评论")
    @PostMapping("delete/{id}")
    public Result deleteCommentById(@PathVariable("id") Long commentId){
        return commentService.deleteUserById(commentId);
    }
}
